<?php

/**
 * Coach form base class.
 *
 * @method Coach getObject() Returns the current form's model object
 *
 * @package    makethetouch
 * @subpackage form
 * @author     Sebastien Chassande-Barrioz
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCoachForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idcoach'           => new sfWidgetFormInputHidden(),
      'level'             => new sfWidgetFormInputText(),
      'level1_course'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'add_empty' => true)),
      'level1_valid_date' => new sfWidgetFormDate(),
      'level2_course'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_2'), 'add_empty' => true)),
      'level2_valid_date' => new sfWidgetFormDate(),
      'level3_course'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Course_3'), 'add_empty' => true)),
      'level3_valid_date' => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'idcoach'           => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idcoach')), 'empty_value' => $this->getObject()->get('idcoach'), 'required' => false)),
      'level'             => new sfValidatorInteger(),
      'level1_course'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course'), 'required' => false)),
      'level1_valid_date' => new sfValidatorDate(array('required' => false)),
      'level2_course'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course_2'), 'required' => false)),
      'level2_valid_date' => new sfValidatorDate(array('required' => false)),
      'level3_course'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Course_3'), 'required' => false)),
      'level3_valid_date' => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('coach[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Coach';
  }

}
